<template>
  <div>
     <h2>我是child1组件</h2>
     <input type="text" v-model="title"/>
     <button @click="tochangeTitle(title)">changtitle</button>
  </div>
</template>
<script>
import { mapMutations } from 'vuex';
export default {
  data() {
    return {
      title:"",
    };
  },
  methods: {
     aaa(){
         console.log('我是子组件1中的aaa方法')
     },

     //child1和child2共享这个changetitle方法 
     ...mapMutations(['changTitle']),
     //去修改child2里面的title
     tochangeTitle(){
       this.changTitle(this.title)
     }
  }
}
</script>